Skip to content

DEV-1306: Android HIL samplingRates, configuring straight after a stop - #138

Merged
JongChern merged 1 commit into
DEV-1266_android_hil_queue_stressfrom
DEV-1306_android_hil_sampling_rates
Oct 23, 2026
Merged

JongChern merged 1 commit into
DEV-1266_android_hil_queue_stressfrom
DEV-1306_android_hil_sampling_rates

Conversation

@JongChern

Copy link
Copy Markdown
Contributor

DEV-1306. A new Android HIL scenario, samplingRates, that reproduces the driver's configure-after-stop bug and shows #135's driver bump (0.11.11_beta, now on master) fixes it on Android. Stacked on #136; merge #128, #134 and #136 first.

The bug

Up to driver 0.11.10_beta, a configuration written straight after stopStreaming() could lose its first chunk, the one holding the sampling rate. operationPrepare() cleared the instruction list while the STOP was still in flight, and the stop's reply then retired the next instruction in its place. The unit kept its old rate, with no error. The Java HIL's samplingRates found it (Shimmer-Java-Android-API#337). Android configures through the same driver code over both transports, and the Android HIL had no scenario that configures after a stop.

The scenario

As in the Java and shimmer-logandstream HILs, it writes 51.2, 256 and 512 Hz in turn and streams 5 s at each, then writes the unit's own rate back. Every configure but the first comes straight after a stop, as an app that changes the rate does.

The Android configure can finish on the manager's SUCCESS without looking at the rate, so the scenario also checks that the rate read back from the unit is the one written. No SD card is needed. The runner runs it by default and the README lists it.

Tested on the bench

s3r-2f31 (Shimmer3R, LogAndStream v1.1.22) over BLE, from an M2101K6G phone on Android 11, with a 1-byte link CRC:

Driver Result
0.11.7_beta fails 2 of 2 runs. Run 1: 256 Hz written after a stop, 51.2 Hz read back; the unit's own 256 Hz written back after a stop, 512 Hz read back. Run 2: 256 Hz written after a stop, 51.2 Hz read back
0.11.11_beta passes 2 of 2 runs: every rate written was read back, and every stream passed

The 0.11.7 log has DEV-1306's exact signature. After STOP_STREAMING_COMMAND, the configuration sent only the SET_INFOMEM chunks at offsets 0x0080 and 0x0100. The chunk at 0x0000, which holds the sampling rate, was never sent, so the read-back still showed the old rate's divisor (0x0280, 51.2 Hz).

🤖 Generated with Claude Code

Up to driver 0.11.10_beta, a configuration written straight after
stopStreaming() could lose its first chunk, the one holding the sampling
rate: operationPrepare() cleared the instruction list while the STOP was
still in flight, and the stop's reply then retired the next instruction in
its place. The unit kept its old rate. The Java HIL's samplingRates found it
on a Shimmer3 and a Shimmer3R. Android configures through the same driver
code over both transports, and had no scenario for it.

samplingRates, as in the Java and shimmer-logandstream HILs, writes 51.2, 256
and 512 Hz in turn and streams 5 s at each, then writes the unit's own rate
back; every configure but the first comes straight after a stop. Unlike the
Java HIL's configure, the Android one can finish on the manager's SUCCESS
without looking at the rate, so the scenario checks that the rate read back
is the one written. No SD card is needed. The runner runs it by default and
the README lists it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JongChern
JongChern merged commit 84e97ab into DEV-1266_android_hil_queue_stress Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant